﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Project.Ycm20250401.Service._20250418.Infra.Repository
{
    public class UserRepository : IUserRepository
    {
        public async Task<bool> AddUserAsync(UserRegister user)
        {
           if (user == null)
            {
                throw new ArgumentException("user is null");
            }
           /*
            * 判断用户手机号是否已注册
            * 保存用户信息到数据库
            * **/
           if (user.Phone.Equals("123456"))
            {
                throw new ArgumentException("手机号已经注册！");
            }
            return true;
        }

        public async Task<UserLogin?> GetUserByUserNameAsync(string userCode)
        {
            var user = new UserLogin("123456", "admin");
            return user;
        }
    }
}
